$(function() {
	var Accordion = function(el, multiple) {
		this.el = el || {};
		this.multiple = multiple || false;

		// Variables privadas
		var links = this.el.find('.link');
		// Evento
		links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
	};

	Accordion.prototype.dropdown = function(e) {
		var $el = e.data.el;
			$this = $(this);
			$next = $this.next();
		$next.slideToggle();
		$this.parent().toggleClass('open').siblings('li').removeClass('open');

		if (!e.data.multiple) {
			$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
		}
	};

	var accordion = new Accordion($('#accordion'), false);
	$('.submenu li').click(function () {
		$(this).addClass('current').siblings('li').removeClass('current');
	});

	$('.mobile_menu').on('click','li',function(){
		let index=$(this).index()
		$(this).hasClass('item_active')?$(this).removeClass('item_active'):$(this).addClass('item_active').siblings('li').removeClass('item_active')
		if(index==1){
			$('.course_menu').removeClass('other_open')
			$('.order_menu').hasClass('other_open')?$('.order_menu').removeClass('other_open'):$('.order_menu').addClass('other_open')
		}else if(index==2){
			$('.order_menu').removeClass('other_open')
			$('.course_menu').hasClass('other_open')?	$('.course_menu').removeClass('other_open'):$('.course_menu').addClass('other_open')
		}
	})
});